package com.sunchen.asc.service.user.repository;

import com.sunchen.asc.service.user.domain.Resource;
import com.sunchen.asc.service.user.vo.ResourceVo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface ResourceRepository extends JpaRepository<Resource,Long> {

    @Query("select new com.sunchen.asc.service.user.vo.ResourceVo(t.id,t.url,t.title) from Resource t")
    List<ResourceVo> findVo();

    Page<Resource> findByTitleLike(String title, Pageable pageable);
}
